﻿using System.Text;

namespace Framework.Utils
{
    public class Converter
    {
        public static byte[] GetBytes(string input, bool unicode = false)
        {
            Encoding encoding;

            if(unicode)
                encoding = new UnicodeEncoding();
            else
                encoding = new ASCIIEncoding();

            return encoding.GetBytes(input);
        }

        public static string ToString(byte[] input, bool unicode = false)
        {
            Encoding encoding;

            if (unicode)
                encoding = new UnicodeEncoding();
            else
                encoding = new ASCIIEncoding();

            return encoding.GetString(input);
        }

    }
}
